<?php

namespace Modules\Shop\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ArticleRequest extends FormRequest
{
    //验证规则
    public function rules()
    {
        return [
        'title'=>'required|between:6,20|',
        'category_id'=>'required',
        'author' => 'required',
        'content' => 'required',
        'thumb' => 'required',
        ];
    }

    //错误信息处理
    public function messages()
    {
        return array (
            'author.required'=>'作者不能为空',
            'content.required'=>'内容不能为空',
            'thumb.required'=>'不能不上传图片',
);
    }

    //权限验证
    public function authorize()
    {
        return true;
    }
}
